import { commonParams } from './config'
import axios from 'axios'

export function getSingerList() {
  const url = '/Api/getSingerList'

  const data = Object.assign({}, commonParams, {
    channel: 'singer',
    page: 'list',
    key: 'all_all_all',
    pagesize: 100,
    pagenum: 1,
    hostUin: 0,
    needNewCode: 0,
    platform: 'yqq'
  })

  return axios.get(url, {
    params: data
  }).then((res) => {
    return Promise.resolve(res.data)
  })
}

export function getSingerDetail(singerId) {
  const url = '/Api/getSingerDetail'

  const data = Object.assign({}, commonParams, {
    '-': 'getSingerSong8503960547349316',
    g_tk: 5381,
    sign: 'zza0pcmpf7ysiv5mnf6be8abd941f9f2b62c18f39dd6266e6',
    loginUin: 0,
    hostUin: 0,
    format: 'json',
    inCharset: 'utf8',
    outCharset: 'utf-8',
    notice: 0,
    platform: 'yqq.json',
    needNewCode: 0,
    data: {
      "comm": { "ct": 24, "cv": 0 }, "singerSongList": {
        "method": "GetSingerSongList", "param": {
          "order": 1,
          "singerMid": `${singerId}`, "begin": 0, "num": 10
        }, "module": "musichall.song_list_server"
      }
    }
  })
  return axios.get(url, {
    params: data
  }).then((res) => {
    return Promise.resolve(res.data)
  })
}

